package mrdemo002;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class QuChongMap  extends Mapper<LongWritable, Text, Text, Text>{
	
	private Text val = new Text("");

	@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Text>.Context context)
			throws IOException, InterruptedException {
		
		String line = value.toString();
		
		//输入的数据行，长度大于0则输出
		// 核心：考虑<k2,v2>是什么？
		// 数据文件的每一行本身作为k2,这样在map结束排序分组后，k2相同的就只有一份
		//  v2就是一个常量
		if(line!=null && line.trim().length()>0) {
			context.write(new Text(line.trim()), val );
		}
	}
}
